// 系统管理接口
import request from '@/utils/request';
// -------------------------------------------------- //
// 系统用户的接口

// 获取系统用户表格
// POST /selectSystemUsers?pageNum=1&pageSize=4&username=&name=&sex=&phone=&status=0
// 参数：查询字符串
export const reqSystemUsersList = (pageNum, pageSize, username, name, sex, phone, status) => request({ url: `/selectSystemUsers?pageNum=${pageNum}&pageSize=${pageSize}&username=${username}&name=${name}&sex=${sex}&phone=${phone}&status=${status}`, method: "POST" })
// 获取部门信息
// POST /selectbm
// 无参
export const reqSystemBm = () => request({ url: `/selectbm`, method: "POST" });
// 获取职务信息
// POST /selectzw
// 无参
export const reqSystemZw = () => request({ url: `/selectzw`, method: "POST" });
// 获取角色信息
// POST /selectUserSystemRoles
export const reqSystemRoles = () => request({ url: `/selectUserSystemRoles`, method: "POST" });
// 添加或修改信息
// POST /addSystemUser?username=11111&password=222222&jobid=33333&rid=4&duty=27&name=123123&img=&sex=%E5%A5%B3&birthday=2023-11-16&phone=1213123&tel=3123123&department=30&resdepartment=30&status=2
// 参数:查询字符串
export const reqAddSystemUser = (username, password, jobid, rid, duty, name, img, sex, birthday, phone, tel, department, resdepartment, status) => request({ url: `/addSystemUser?username=${username}&password=${password}&jobid=${jobid}&rid=${rid}&duty=${duty}&name=${name}&img=${img}&sex=${sex}&birthday=${birthday}&phone=${phone}&tel=${tel}&department=${department}&resdepartment=${resdepartment}&status=${status}`, method: "POST" });
// 按照id查询
// POST /selectSystemUserById?id=${id}
// 参数: 查询字符串
export const reqSelectUserById = (id) => request({ url: `/selectSystemUserById?id=${id}`, method: "POST" });
// 编辑
// POST /updateSystemUser?id=2&username=bb&rid=5&password=bbb&jobid=2141351&duty=26&name=%E5%93%88%E5%93%88%E5%93%88%E5%93%88&img=52f835e3-877a-49a7-a276-e1a018be42e4-2%20(9).jpg&sex=%E5%A5%B3&birthday=2023-04-08&phone=bbb&tel=111&department=30&resdepartment=31&status=2
// 参数：拼接字符串
export const reqUpdateSystemUser = (id, username, password, jobid, rid, duty, name, img, sex, birthday, phone, tel, department, resdepartment, status) => request({ url: `/updateSystemUser?id=${id}&username=${username}&password=${password}&jobid=${jobid}&rid=${rid}&duty=${duty}&name=${name}&img=${img}&sex=${sex}&birthday=${birthday}&phone=${phone}&tel=${tel}&department=${department}&resdepartment=${resdepartment}&status=${status}`, method: "POST" });
// 冻结
// POST /updateSystemUserStatus?id=2&status=1;
// 参数：查询字符串
export const reqUpdateSystemUserByStatus = (id, status) => request({ url: `/updateSystemUserStatus?id=${id}&status=${status}`, method: "POST" });
// 删除
// POST /deleteSystemUser?id=24
// 参数：id
export const reqDeleteSystemUserById = (id) => request({ url: `/deleteSystemUser?id=${id}`, method: "POST" });
// -------------------------------------------------- //



// -------------------------------------------------- //
// 系统角色接口
//获取系统角色list
export const reqSystemRoleList = (pageNum, pageSize, rolename) => request({
  url: `selectSystemRoles?pageNum=${pageNum}&pageSize=${pageSize}&rolename=${rolename}`,
  method: "POST"
});
//获取系统角色用户列表

export const reqUserByRole = (id, pageNum, pageSize) => request({
  url: `selectSystemUserByRole?id=${id}&pageNum=${pageNum}&pageSize=${pageSize}`,
  method: "POST"
});

//查询菜单列表
export const reqselectMenus = () => request({
  url: `selectMenus`,
  method: "POST"
});

//授权查询
export const selectRoleOneMenus = (id) => request({
  url: `selectRoleOneMenus?id=${id}`,
  method: "POST"
});
//更新授权查询
export const updateRoleMenus = (mids, rid) => request({
  url: `updateRoleMenus?mids=${mids}&rid=${rid}`,
  method: "POST"
});
//回显更新授权查询
export const updateMenus = (id) => request({
  url: `selectRoleOneMenus?id=${id}`,
  method: "POST"
});
//获取角色详情
export const reqRolesById = (id) => request({
  url: `selectSystemRolesById?id=${id}`,
  method: "POST"
})
//提交修改角色详情
export const updateSystemRole = (id, rolename, rolecode, createtime, notes, sort) => request({
  url: `updateSystemRole?id=${id}&rolename=${rolename}&rolecode=${rolecode}&createtime=${createtime}&notes=${notes}&sort=${sort}`,
  method: "POST"
})
//删除角色
export const deleteSystemRole = (id) => request({
  url: `deleteSystemRole?id=${id}`,
  method: "POST"
})

// 新增角色
export const addSystemRole = (rolename, rolecode, createtime, notes) => request({
  url: `addSystemRole?id=0&rolename=${rolename}&rolecode=${rolecode}&createtime=${createtime}&notes=${notes}&sort=0`,
  method: "POST"
})













// -------------------------------------------------- //
// 数据字典接口
// 查询数据字典列表
// POST /selectAllDict1?pageNum=1&pageSize=2
// 参数：查询字符串
// 弃用-------- 
export const reqAllDirct1 = (pageNum, pageSize) => request({ url: `/selectAllDict1?pageNum=${pageNum}&pageSize=${pageSize}`, method: 'POST' });
// 搜索
// POST /selectDict1Byname?pageNum=1&pageSize=2&dicname=123
// 拼接字符串
export const reqAllDirByName = (pageNum, pageSize, dicname) => request({ url: `/selectDict1Byname?pageNum=${pageNum}&pageSize=${pageSize}&dicname=${dicname}`, method: 'POST' });
// 新增字典
// POST /addDict1?id=0&dicname=test&parentid=0&code=111&desc=11111&sort=0&status=0
// 参数：拼接字符串
export const reqAddDirct1 = (id, dicname, parentid, code, desc, sort, status) => request({ url: `/addDict1?id=${id}&dicname=${dicname}&parentid=${parentid}&code=${code}&desc=${desc}&sort=${sort}&status=${status}`, method: 'POST' });
// 回显字典
// POST /selectDict1ById?id=44
export const reqSelectById = (id) => request({ url: `/selectDict1ById?id=${id}`, method: 'POST' });
// 修改字典
// POST /updateDict1?id=44&dicname=123&code=1&desc=1&sort=0&status=1
export const reqUpdateDirct1 = (id, dicname, code, desc, sort, status) => request({ url: `/updateDict1?id=${id}&dicname=${dicname}&code=${code}&desc=${desc}&sort=${sort}&status=${status}`, method: 'POST' });
// 删除字典
// /deleteDictById?id=44
export const reqDeleteById = (id) => request({ url: `/deleteDictById?id=${id}`, method: 'POST' });
// /deleteDict2Byparentid?parentid=44
export const reqDeleteByIdFormParent = (id) => request({ url: `/deleteDict2Byparentid?parentid=${id}`, method: 'POST' });
// 查询子集字典
// POST /selectDict2Byparntid?id=25&pageNum=2&pageSize=2&status=0&dicname=
export const reqChildDic = (id, pageNum, pageSize, status, dicname) => request({ url: `/selectDict2Byparntid?id=${id}&pageNum=${pageNum}&pageSize=${pageSize}&status=${status}&dicname=${dicname}` });
// 添加子集
// POST /addDict2?id=0&dicname=123&parentid=46&desc=1&code=1&sort=0&status=1
export const reqAddChildDic = (dicname, parentid, desc, code, sort) => request({ url: `/addDict2?id=0&dicname=${dicname}&parentid=${parentid}&desc=${desc}&code=${code}&sort=${sort}&status=1`, method: 'POST' });
// 回显儿子字典
// POST /selectDict1ById?id=47
export const reqChildDicById = (id) => request({ url: `/selectDict1ById?id=${id}`, method: 'POST' });
// 更新儿子字典
// POST /updateDict2?id=48&dicname=123123&code=1&desc=1&sort=0&status=2
export const reqUpdateChildDic = (id, dicname, desc, code, sort, status) => request({ url: `/updateDict2?id=${id}&dicname=${dicname}&code=${code}&desc=${desc}&sort=${sort}&status=${status}`, method: 'POST' });
// 删除儿子
// POST /deleteDictById?id=46
export const reqDeleteChildDic2 = (id) => request({ url: `/deleteDictById?id=${id}`, method: 'POST' });

// -------------------------------------------------- //
// 系统菜单接口
// /selectAllMenusBymenusname?pageNum=1&pageSize=2&menusname=123123123
export const reqAllMenus = (pageNum, pageSize, menusname) => request({ url: `/selectAllMenusBymenusname?pageNum=${pageNum}&pageSize=${pageSize}&menusname=${menusname}`, method: 'GET' });
// 新增菜单
// /addMenus
export const reqAddMenus = (query) => request({url:`/addMenus`,method:"POST",data:query});
// 回显菜单
export const reqMenusById = (id) => request({url:`/selectMenusById?id=${id}`,method:"GET"});
// 修改菜单
// /updateMenu?id=2&assembly=2&parentid=0&menusname=%E5%95%86%E6%88%B7%E7%AE%A1%E7%90%86&level=1&icon=2&path=/&sort=123
export const reqUpdateMenus = (id,assembly,parentid,menusname,level,icon,path,sort) => request({url:`/updateMenu?id=${id}&assembly=${assembly}&parentid=${parentid}&menusname=${menusname}&level=${level}&icon=${icon}&path=${path}&sort=${sort}`,method:"POST"});
// 删除菜单
// /deleteMenu?id=2
export const reqDeleteMenus = (id) => request({url:`/deleteMenu?id=${id}`,method:"GET"});